package com.xbb.entity;

import java.io.Serializable;
import java.util.List;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * <p>
 * 模块表
 * </p>
 *
 * @author Mr xie
 * @since 2020-05-19
 */
@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="Module对象", description="")
public class Module implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer id;

    @NotNull(message = "模块名称不能为空")
    @Size(min = 2, max = 11, message = "模块名称必须是2-11个字符")
    @JsonProperty("title")
    private String name;

    @NotNull(message = "父模块不能为空")
    private Integer parentId;

    private String path;

    private Integer weight;

    //是否被选中
    @TableField(exist = false)
    private boolean checked;

    //子模块们
    @TableField(exist = false)
    private List<Module> children;
}
